package org.agilelang.editor.dialog;

/*
 AgileLang - A fourth generation language(http://www.agilelang.org).

 Copyright (C) 2013 Roderick Cusirramos (roderick20@hotmail.com)

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
import org.agilelang.util.DialogBase;

public class DlgNewProject extends DialogBase {

    JTextField txtPath = new JTextField(25);
    JTextField txtName = new JTextField(25);

    public DlgNewProject() {
        super("New Project", 2);
        initComponents();
        initUI();
    }

    private void initComponents() {

        txtPath.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                JFileChooser fileChooser = new JFileChooser();
                fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
                int result = fileChooser.showSaveDialog(null);
                if (result == JFileChooser.CANCEL_OPTION) {
                    return;
                }
                txtPath.setText(fileChooser.getSelectedFile().getAbsolutePath());
            }
        });

        this.addLineTxt("Name", txtName);
        this.addLineTxt("Path", txtPath);
    }

    public String getName() {
        return txtName.getText();
    }

    public String getTxtPath() {
        return txtPath.getText();
    }

   
}